package com.binarysoft.service.common.snmp;

import java.io.Serializable;

public class SnmpTarget implements Serializable {
	private int snmpVersion;
	private String hostAddress = null;
	private int snmpPort;
	// //////////////v1 v2c/////////////////
	private String readCommunity = null;
	private String writeCommunity = null;

	// //////////////v3////////////////////////
	// user name
	private java.lang.String userName;
	/**
	 * 1)NoAuth&NoPriv 2)Auth&NoPriv 3)Auth&Priv
	 * 
	 */
	private int securityLevel;
	/**
	 * MD5, SHA
	 */
	private int authProtocol;
	private String authPassword;
	/**
	 * AES,AES128,AES192,AES256,DES
	 */
	private int privProtocol;
	private String privatePassword;
	
	/**
	 * For V3.    Added on 2009-06-16
	 */
	private String contextName;
	
	private String charSet = SnmpService.CHARSET_GB2312;


	/**
	 * @return the contextName
	 */
	public String getContextName() {
		return contextName;
	}

	/**
	 * @param contextName the contextName to set
	 */
	public void setContextName(String contextName) {
		this.contextName = contextName;
	}

	public String getCharSet() {
		return charSet;
	}

	public void setCharSet(String charSet) {
		this.charSet = charSet;
	}

	public int getSnmpVersion() {
		return snmpVersion;
	}

	public void setSnmpVersion(int snmpVersion) {
		this.snmpVersion = snmpVersion;
	}

	public String getHostAddress() {
		return hostAddress;
	}

	public void setHostAddress(String hostAddress) {
		this.hostAddress = hostAddress;
	}

	public int getSnmpPort() {
		return snmpPort;
	}

	public void setSnmpPort(int snmpPort) {
		this.snmpPort = snmpPort;
	}

	public String getReadCommunity() {
		return readCommunity;
	}

	public void setReadCommunity(String readCommunity) {
		this.readCommunity = readCommunity;
	}

	public String getWriteCommunity() {
		return writeCommunity;
	}

	public void setWriteCommunity(String writeCommunity) {
		this.writeCommunity = writeCommunity;
	}

	public java.lang.String getUserName() {
		return userName;
	}

	public void setUserName(java.lang.String userName) {
		this.userName = userName;
	}

	public int getSecurityLevel() {
		return securityLevel;
	}

	public void setSecurityLevel(int securityLevel) {
		this.securityLevel = securityLevel;
	}

	public int getAuthProtocol() {
		return authProtocol;
	}

	public void setAuthProtocol(int authProtocol) {
		this.authProtocol = authProtocol;
	}

	public String getAuthPassword() {
		return authPassword;
	}

	public void setAuthPassword(String authPassword) {
		this.authPassword = authPassword;
	}

	public int getPrivProtocol() {
		return privProtocol;
	}

	public void setPrivProtocol(int privProtocol) {
		this.privProtocol = privProtocol;
	}

	public String getPrivatePassword() {
		return privatePassword;
	}

	public void setPrivatePassword(String privatePassword) {
		this.privatePassword = privatePassword;
	}

	@Override
	public boolean equals(Object obj) {
		boolean c1 = obj instanceof SnmpTarget;
		boolean c2 = ((SnmpTarget) obj).hostAddress.equals(this.hostAddress);
		boolean c3 = ((SnmpTarget) obj).snmpPort == this.snmpPort;
		return c1 && c2 && c3;
	}

	@Override
	public int hashCode() {
		return toString().hashCode();
	}

	@Override
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("HostAddress[").append(hostAddress).append("]Port[").append(snmpPort).append("]");
		return sb.toString();
	}
}
